<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
	<%@ include file="/static/admin/jsp/include.jsp"%>

	<script type="text/javascript">
        var grid;

        $(function() {
            grid = $('#grid').datagrid({
                url : sy.contextPath + '/userNewsComment/list',
                columns : [ [ {
                    width : $(this).width() * 0.1,
                    title : '发布者昵称',
                    field : 'userNickName',
                    align : 'center',
                },{
                    width : $(this).width() * 0.1,
                    title : '发布者账号',
                    field : 'account',
                    align : 'center',
                },{
                    width : $(this).width() * 0.1,
                    title : '内容',
                    field : 'content',
                    align : 'center',
				},{
                    width : $(this).width() * 0.1,
                    title : '操作',
                    field : 'isForbidden',
                    align : 'center',
                    formatter : function(value, row, index) {
                        console.log(row)
						if(value == 0){
							return '<a  href="javascript:void(0);" class="button button-blue" title="删除评论并扣分" onclick="forbidden('+row.id+')">删除评论并扣分</a>';

						}else if(value == 1){
                            return '已禁用';
						}else{
						    return '--';
						}

                    }
                }
                ] ]
            });


            $('#type').combobox({
                onSelect: function(rec){
                    grid.datagrid('load',sy.serializeObject($('#searchForm')));
                }
            });
        });

        /**
		 * 入库
         * @param id
         */
        function verify(id){
            var data = {
                		id : id,
						isVerify : 3
            			}
            SaveData(data);
		}

		//禁用并且扣分
		function forbidden(id){
            var data = {
                id : id,
                isForbidden : 1
            }
            var url = sy.contextPath + '/userNewsComment/forbidden';
            $.post(url, data, function() {
                grid.datagrid('reload');
            }, 'json');
		}
	</script>
</head>
<body>
<div id="toolbar">
	<form id="searchForm">
		<div>
		</div>
	</form>
	<div class="tbbutton">
	</div>
</div>
<table id="grid" data-options="fit:true,border:false"></table>
</body>
</html>